const Api = {
    /**
     * 登陆接口
     * @param data
     * @param url
     * @returns {Promise<any>}
     */
    login:function (data, url) {
        let grant_type
        if (data.grant_type) {
            grant_type = data.grant_type
        } else {
            grant_type = "password"
        }
        data.grant_type = grant_type;
        data.scope = "all";
        return axios({
            method: "post",
            url: '/uaa/oauth/token',
            data,
            headers: {
                Authorization: "Basic Y2xpZW50OnNlY3JldA=="
            }
        }).then(function (res) {
            localStorage.setItem('user',JSON.stringify(res))      
                location.href = "index.html"   
            return Promise.resolve(res)
        }).catch(function (err) {
            console.log(err.txt)
        })
    }
    
}